package ciyuan.Item.SkillBook;

import ciyuan.Effect.Effects;
import ciyuan.Item.ItemGroups;
import ciyuan.Item.TypeInterface.SkillBookType;
import ciyuan.Player.Skill.SkillUtils;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.potion.EffectInstance;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TranslationTextComponent;

public class Inspire extends SkillBookType {

    public Inspire() {
        super(new Properties().tab(ItemGroups.SkillBook));
    }

    @Override
    public void keyDown(PlayerEntity playerEntity) {
        SkillUtils.setSkillColdInterval(playerEntity, this, 15 * 1000);

        if (playerEntity.level.isClientSide) {
            return;
        }

        if ((playerEntity.getHealth() / playerEntity.getMaxHealth()) > 0.7) {
            playerEntity.addEffect(new EffectInstance(Effects.battle_inspiration,200,0));
        } else {
            playerEntity.addEffect(new EffectInstance(Effects.life_inspiration,200,0));
        }
        SkillUtils.saveSkillCastTime(playerEntity,this);
    }

    @Override
    public String getSkillCastName() {
        return "inspire";
    }

    @Override
    public ITextComponent getSkillDescription() {
        return new TranslationTextComponent("ciyuan.skill.desc.8");
    }

    @Override
    public ITextComponent getSkillName() {
        return new TranslationTextComponent("ciyuan.skill.name.8");
    }
}
